﻿Public Class Reports

    Sub New()
        InitializeComponent()
        ToolBar.Parent = Nothing
        ToolBar.Renderer = New FirefoxRenderer
        BtnHelp.DropDown = HelpMenu
        FirefoxToolstrip.ApplyProperties(Document.ToolBar)
    End Sub

    Sub Start(ByVal Title As String)
        Document.Clear()
        Document.AddSection()
        Document.AddTitle("<b>" & Title & "/n")
    End Sub

    Private Sub New_Click(sender As System.Object, e As System.EventArgs) Handles MnuNew.Click, BtnNew.Click
        If Not FrmReport.ShowDialog = DialogResult.OK Then Return
        Select Case FrmReport.ListView1.SelectedIndices(0)
            Case 0
                Dim birim As ComboBox = FrmReport.Panel1.Controls("birim")
                Dim ay As ComboBox = FrmReport.Panel1.Controls("ay")
                Start("Aya Göre İzinli Personel Raporu (" & ay.Text & ")")
                Dim Rs = Service.Rapor.AyaGoreIzinliPersonel(birim.SelectedValue, ay.SelectedValue)
                Document.AddTable("6l;1d;1d")
                Document.AddHeader("Adı Soyadı", "Baş.Tar.", "Bit.Tar.")
                Do Until Rs.EOF
                    Document.AddRow(ToTitle(Rs("adi") & " " & Rs("soyadi")), Rs("tarih1"), Rs("tarih2"))
                    Rs.MoveNext()
                Loop
                Document.Display()
        End Select
    End Sub

    Sub NewReport()
        MnuNew.PerformClick()
    End Sub

End Class
